import { createBrowserRouter } from 'react-router-dom'

import Login from '@/pages/Login'
import Layout from '@/pages/Layout'
import Home from '@/pages/Home'
import Check from '@/pages/Check'
import Report from '@/pages/Report'
import AuthRoute from '@/components/AuthRoute'
import Page404 from '@/pages/Page404'

const router = createBrowserRouter([
  {
    path: '/',
    element: 
      <AuthRoute>
        <Layout />
      </AuthRoute>,
    children: [
      {
        index: true,
        element: <Home />,
      },
      {
        path: 'check',
        element: <Check />,
      },
      {
        path: 'report',
        element: <Report />,
      },
    ],
  },
  {
    path: '/login',
    element: <Login />,
  },
  {
    path: '*',
    element: <Page404/>
  }
])

export default router